﻿ @{
     var sql = Request["k"] + string.Empty;

     System.Data.DataTable dt = new System.Data.DataTable();
     
     if(sql!="")
     {
         sql = " and ProductTypeID = '" + sql + "'";
         dt = V5.GZProduct.Query_By("*", sql, " TotalNum desc, CreateDate DESC", 0);
     }
     var user = (V5_Model.ModelGZUser)Session["isLogin"];  
}

<table border=1 cellpadding=0 cellspacing=0 width="100%">
    <tr> 
        <th>NO</th>
        <th>商品名称</th>
        <th>单位</th>
        <th>单价</th>
        <th>可订数量</th>
        <th>下订数量</th>
        <th>操作</th>
    </tr>
    @if (dt != null && dt.Rows.Count > 0)
    {
        int i= 1;
        foreach (System.Data.DataRow item in dt.Rows)
        { 
        
          int itemNum = int.Parse(double.Parse(item["TotalNum"] + string.Empty).ToString("0"));
          var Model = new V5_EShop._Class.BLL.BLLGZProduct().GetModel(System.Guid.Parse(item["ID"]+string.Empty));
          decimal prices = new V5_EShop._Class.BLL.BLLGZProduct().GetPrice(user, Model);
            
          <tr style="height:30px" id="t_list_@(item["ID"])"> 
            <td align=center>@i</td>
            <td style="padding-left:5px" title="@item["ProductName"]" id="item_title_@(item["ID"])"> 
                @{
                    var s = item["ProductName"] + string.Empty ;
                    if(s.Length>25)        
                    {
                        @(s.Substring(0,25)+"...")
                    }
                    else
                    {
                        @s
                    } 
                }
            
            </td>
            <td align=center >
            @{
            System.Data.DataTable tUn = new V5_EShop._Class.BLL.BLLGZUnit().GetList(" id = '" + item["UnitID"]+"'").Tables[0];

            if (tUn != null && tUn.Rows.Count > 0)
            {
                @(tUn.Rows[0]["UnitName"]) 
            }
            
            }
            
            </td>
            <td align="center" style="width:80px">@prices</td> 
            <td align="center" ><span style="color:red">@itemNum</span></td>
            <td align="center">@{
                if (itemNum > 0) 
                {  
                    @Html.TextBox("txt_input_" + item["ID"], 1, new { style="width:20px"}); 
                }
                else
                {
                    @("暂无存货")
                }
                 
                }</td>
            <td>
                @if (itemNum > 0) 
                {  
                    <a href="javascript:;" data-id="@item["ID"]" data-name="@item["ProductName"]" data-total="@itemNum" class="item_flow_select">选择</a>
                } 
            </td>
         </tr>
            i++;
        }               
    }
</table>  
 

 

